<?php
namespace Index\Controller;
use Think\Controller;
class IndexController extends CommonController {
    public function index(){
    	$hotuser = D('user')->hotuser();
    	$hotview=D('question')->hotview();

    	$sql = "select t1.*,t2.nickname,t2.face,t3.name from question t1 inner join user t2 on t1.uid=t2.id inner join category t3 on t1.cid=t3.id where t1.top='1'";

    	$topData = M()->query($sql);

    	$count      = M('question')->count();// 查询满足要求的总记录数
		$Page       = new \Think\Page($count,4);// 实例化分页类 传入总记录数和每页显示的记录数(25)
		$show       = $Page->show();// 分页显示输出

		// var_dump($Page->firstRow,$Page->listRows);


		$sql = "select t1.*,t2.nickname,t2.face,t3.name from question t1 inner join user t2 on t1.uid=t2.id inner join category t3 on t1.cid=t3.id order by t1.id desc limit ".$Page->firstRow.",".$Page->listRows;

        var_dump($sql);

		$allData = M()->query($sql);

        // var_dump($allData);exit;


		$this->assign('show',$show);
		$this->assign('allData',$allData);
    	$this->assign('hotuser',$hotuser);
        $this->assign('hotview',$hotview);
        $this->assign('topData',$topData);

        $this->assign('title',"专业提供老司机资源");
        $this->display();

    }

    public function send()
    {
       $res = Sendmsg(18925139194,"小小明",765879);

       var_dump(json_decode($res,true));
    }
}